package com.example.base.job.systemjob;

import com.alibaba.fastjson.JSONObject;
import com.example.base.app.App;
import com.example.base.app.AppSecretInfo;
import com.example.base.app.AppUtils;
import lombok.extern.slf4j.Slf4j;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;

import java.util.List;

@Slf4j
@Component
@DisallowConcurrentExecution
public class SystemJobAppExpire extends QuartzJobBean {

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
       List<App> appList= AppUtils.getAllapp();
       appList.forEach((e)->{
          AppSecretInfo appSecretInfo=e.getAppSecretInfo();
          String appName=appSecretInfo.getAppName();
          String dateStr=appSecretInfo.getExpireDateStr();
          log.info("app名称:{},过期时间{}",appName,dateStr);
       });
    }
}
